<?php

class Rcp_FrontendController extends Zend_Controller_Action {

	const LOGIN_URL = '/rcp/logowanie';
	const LOGGED_URL = '/rcp/menu';
	
	public function init() {
		$this->_helper->viewRenderer->setNoRender(true);

		$compress = (bool) Zend_Registry::get('appConfig')->resources->layout->params->compress;
		$this->_helper->viewRenderer->setNoRender(true);
		$packages = new ViewPackages_PackageCreator('css', 'js/compressed', 'rcp');
		if ($compress) {
			$packages->init();
			$this->view->cssFiles = $packages->getCssFiles();
			$this->view->jsFiles = $packages->getJsFiles();
		} else {
			$this->view->cssFiles = $packages->getOriginalCssFiles();
			$this->view->jsFiles = $packages->getOriginalJsFiles();
		}
		$this->view->rootPath = strpos($this->getRequest()->getServer('REQUEST_URI'), $this->getRequest()->getModuleName()) ? '/' . $this->getRequest()->getModuleName() : '';
		if (!Rcp_Auth::getInstance()->isAuth() && self::LOGIN_URL != $this->getRequest()->getRequestUri()) {
			$this->_redirect(self::LOGIN_URL);
		}
	}

	public function indexAction() {
	}

}